/*
 * @(#)Resource.java 2009-2-19
 * Copyright (c) 2008-2015 by CJK
 * All rights reserved.
 */
package net.beyond.core.entity;

import java.util.Set;

import net.beyond.common.BaseEntity;

/**
 *资源实体
 * 
 * @author Shmiluyu
 * @version 1.000 2009-2-19
 */
public class Resource extends BaseEntity {

	private static final long serialVersionUID = 1L;
	/** 查询时候用，不限制类型 */
	public final static int TYPE_ALL = 0;
	/** 菜单类型 */
	public final static int TYPE_MENU = 1;
	/** 按钮类型 */
	public final static int TYPE_BUTTON = 2;
	/** 子资源 */
	private Set<Resource> children;
	/** 是否启用 */
	private boolean enabled = true;
	/** 资源入口 */
	private String entry;
	/** 资源对应的方法操作 */
	private String op;
	/** 资源类型 */
	private int type = TYPE_MENU;
	/** 父资源 */
	private Resource parent;
	/** 优先级，排序用 */
	private int priority = 0;
	/** 资源名称 */
	private String resourceName;
	/** 别名 */
	private String aliasName;

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getOp() {
		return op;
	}

	public void setOp(String op) {
		this.op = op;
	}

	public String getAliasName() {
		return aliasName;
	}

	public void setAliasName(String aliasName) {
		this.aliasName = aliasName;
	}

	/** ����ģ�� */
	private Module module;

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Resource) {
			return this.getId() == ((Resource) obj).getId();
		} else {
			return false;
		}
	}

	public String getEntry() {
		return entry;
	}

	public Resource getParent() {
		return parent;
	}

	public int getPriority() {
		return priority;
	}

	public String getResourceName() {
		return resourceName;
	}

	public boolean isEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}

	public void setEntry(String entry) {
		this.entry = entry;
	}

	public void setParent(Resource parent) {
		this.parent = parent;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}

	public void setResourceName(String resourceName) {
		this.resourceName = resourceName;
	}

	public Module getModule() {
		return module;
	}

	public void setModule(Module module) {
		this.module = module;
	}

	public Set<Resource> getChildren() {
		return children;
	}

	public void setChildren(Set<Resource> children) {
		this.children = children;
	}

}
